package all.com.jinyongqunxiax.component;

import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;

import all.com.jinyongqunxiax.JxEditorApplication;
import all.com.jinyongqunxiax.R;

public class JxFormItemImage extends JxForm.AbstractItemViewModel {
    private String title;
    private String imagePath;

    public JxFormItemImage(int level, String title, String imagePath) {
        super(R.layout.jxform_image_item, level,null);
        this.title = title;
        this.imagePath = imagePath;
    }

    @Override
    void bind(View view) {
        TextView textView = view.findViewById(R.id.jx_form_image_item_title);
        if (textView != null) {
            textView.setText(title);
        }

        ImageView imageView = view.findViewById(R.id.jx_form_image_item_value);
        if (imageView != null) {
            Glide.with(JxEditorApplication.shared).load(imagePath).into(imageView);
        }
    }

    @Override
    int removeButtonID() {
        return R.id.form_item_delete;
    }
    @Override
    int intentViewID() {
        return R.id.form_header_guide_line;
    }
}
